/**
 * Copyright 2007 Jason Horman, Pete Aykroyd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.util;

import java.math.BigInteger;
import java.math.BigDecimal;
import java.util.Date;

public class PrimitiveUtils {
	private PrimitiveUtils() {
	}

	public static boolean isPrimitive(Class type) {
		if (type.isPrimitive())
			return true;

		if (type == String.class) {
			return true;
		} else if (type == Boolean.class) {
			return true;
		} else if (type == Byte.class) {
			return true;
		} else if (type == Character.class) {
			return true;
		} else if (type == Double.class) {
			return true;
		} else if (type == Float.class) {
			return true;
		} else if (type == Integer.class) {
			return true;
		} else if (type == Long.class) {
			return true;
		} else if (type == Short.class) {
			return true;
		} else if (Date.class.isAssignableFrom(type)) {
			return true;
		} else if (type == BigDecimal.class) {
			return true;
		} else if (type == BigInteger.class) {
			return true;
		}

		return false;
	}
}
